<?php
	$page="home";
	//if the url sets a page, get that page
	if (isset ($_GET["page"])) {
		$page = $_GET["page"];
	}
	
	$main = is_file("$page.html");
	
	if ($main == false) {
		$main = is_file ("$page.php");
		if ($main == false) {
			$main = is_file("$page.txt");
		}
	}
	/* if invalid page specified, redirect to home */
	if ($main == false) {
		$main = file_get_contents ("home.html");
		$page = "home";
	}
	else {
		if(is_file("$page.html") == true) {
			$main = file_get_contents ("$page.html");
		}
		else if(is_file("$page.txt") == true) {
			$main = file_get_contents ("$page.txt");
		}
		else{
			$main = file_get_contents ("$page.php");
		}
	}
	
	$static = "RPI Arboretum";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html>
<head>
<title>
Welcome to the Arboretum!
</title>
<script type="text/javascript">
function result(str)
{
var xmlhttp;
if (str.length==0)
  { 
  document.getElementById("trees").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("trees").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getresults.php?q="+str,true);
xmlhttp.send();
}
</script>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="jquery.infinitecarousel3/js/infinitecarousel/jquery.infinitecarousel3.js"></script>
<script type="text/javascript" src="http://webmedia.ku.edu/js/jqueryplugins/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" href="http://webmedia.ku.edu/js/jqueryplugins/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<script>
        $(function(){
        $('#carousel').infiniteCarousel({
                autoPilot: true,
                showControls: false,
                displayTime: 4000,
                transitionSpeed: 400,
                displayProgressRing: false,
                imagePath: 'jquery.infinitecarousel3/js/infinitecarousel/images/'
        });
});
</script>
<script type="text/javascript">
$(document).ready(function(){
  $(".point").fancybox({ 'hideOnContentClick': false,'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
});
</script>
<style>
div.infiniteCarousel {
        margin: 10px auto 0 auto;
        -moz-box-shadow: 0px 0px 10px #333;
        -webkit-box-shadow:  0px 0px 10px #333;
        box-shadow:  0px 0px 10px #333;
        clear:right;
}
</style>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="everything">
<div id="head">
<h1 id="title">RPI Arboretum</h1>
<div id="navigation">
<ul class="menu">
<li class="option"><a href="index.php?page=home">Home</a></li>
<li class="option"><a href="index.php?page=search">Find a Tree</a></li>
<li class="option"><a href="index.php?page=trailwalk">Trail Walk</a></li>
<li class="option"><a href="index.php?page=facts">Facts</a></li>
<li class="option"><a href="index.php?page=donate">Donate</a></li>
<li class="option"><a href="index.php?page=about">About Us</a></li>
</ul>
</div>
</div>

<h1 id="pageTitle"><?php if (is_numeric($page)) {echo "Birch $page"; } else { echo ucfirst($page); } ?></h1>
<?php
	if(is_file("$page.html") == true) {
				echo "$main";
			}
			else{
				eval($main);
			}
?>
</div>
</body>
</html>



